Linux webm002.cluster126.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
/
home
/
ariannadhf
/
www
/
wp-content
/
plugins
/
themeisle-companion
/
dashboard
/
src
/
utils
/
/home/ariannadhf/www/wp-content/plugins/themeisle-companion/dashboard/src/utils/rest.js
/* global obfxDash */ import fetch from 'node-fetch'; export const requestData = async ( route, simple = false, data = {}, urlEncoded = false, method = 'POST' ) => { const options = { method, headers: { Accept: 'application/json', 'Content-Type': urlEncoded ? 'application/x-www-form-urlencoded' : 'application/json', 'x-wp-nonce': obfxDash.nonce, }, }; if ('POST' === method) { options.body = urlEncoded ? data : JSON.stringify(data); } return await fetch(route, options).then((response) => { return simple ? response : response.json(); }); }; export const get = (route, simple) => { return requestData(route, simple, {}, 'GET'); }; export const post = (route, data) => { return requestData(route, false, data, true); };